
<% if (names.length) { %>
    <ul>
      <% names.forEach(function(name){ %>
        <li foo='<%= name + "'" %>'><%= name %></li>
      <% }) %>
    </ul>
  <% } %>


<html>
<head>
  <script src="../ejs.js"></script>
  <script id="users" type="text/template">
    <% if (names.length) { %>
      <ul>
        <% names.forEach(function(name){ %>
          <li><%= name %></li>
        <% }) %>
      </ul>
    <% } %>
  </script>
  <script>
    onload = function(){
      var users = document.getElementById('users').innerHTML;
      var names = ['loki', 'tobi', 'jane'];
      var html = ejs.render(users, { names: names });
      document.body.innerHTML = html;
    }
  </script>
</head>
<body>
</body>
</html>